import Bullet from 'Bullet.js'

class Enemy {
    constructor(ctx) {
        this.ctx = ctx;
        this.img = new Image();
        this.img.src = 'images/enemy.png';
        this.init = {
            x: Math.random() * (this.ctx.canvas.width - 120 / 2 / 2),
            y: -100,
            w: 120 / 2,
            h: 79 / 2
        }
        this.status = true;
        this.bullets = [];
    }
    draw() {
        this.init.y += 2;
        if (this.init.y > this.ctx.canvas.height) {
            this.status = false;
        }
        this.ctx.drawImage(this.img, this.init.x, this.init.y, this.init.w, this.init.h);
    }
}

export default Enemy;